﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace Ornithopter.FlashDiskHelper
{
    public class SystemTray
    {
        private static NotifyIcon _icon;
        public static void Hide()
        {
            if (_icon == null)
            {
                _icon = new NotifyIcon();
                var components = new System.ComponentModel.Container();
                var contextMenu1 = new System.Windows.Forms.ContextMenu();
                var menuItem1 = new System.Windows.Forms.MenuItem();

                // Initialize contextMenu1 
                contextMenu1.MenuItems.AddRange(
                            new System.Windows.Forms.MenuItem[] { menuItem1 });

                // Initialize menuItem1 
                menuItem1.Index = 0;
                menuItem1.Text = "E&xit";
                menuItem1.Click += new EventHandler(menuItem1_Click);

                // Create the NotifyIcon. 
                _icon = new System.Windows.Forms.NotifyIcon(components);

                // The Icon property sets the icon that will appear 
                // in the systray for this application.
                _icon.Icon = new Icon("appicon.ico");

                // The ContextMenu property sets the menu that will 
                // appear when the systray icon is right clicked.
                _icon.ContextMenu = contextMenu1;

                // The Text property sets the text that will be displayed, 
                // in a tooltip, when the mouse hovers over the systray icon.
                _icon.Text = "Form1 (NotifyIcon example)";
                _icon.Visible = true;

                // Handle the DoubleClick event to activate the form.
                _icon.DoubleClick += new EventHandler(_icon_DoubleClick);
            }
        }

        static void _icon_DoubleClick(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        static void menuItem1_Click(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }
    }
}
